//
//  LEESearch.swift
//  SinaWeibo
//
//  Created by 李江波 on 2016/11/14.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

import UIKit


/// @IBDesignable  实时在xib中更新
@IBDesignable class LEESearch: UIButton {
    
    /* 封装
    //可视化视图显示
    @IBInspectable var cornerRadius : CGFloat {
    
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = true
        }
    
        get{
           
            return layer.cornerRadius
        }
    }
    */

    //类方法，加载xib
    class func searchBtn() -> LEESearch{
        let nib = UINib(nibName: "LEESeacher", bundle: nil)
        
        let btn = nib.instantiate(withOwner: nil, options: nil).last as! LEESearch
        
        return btn;
    }

    override func awakeFromNib() {
        
        //图片、文字偏移
        self.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0)
        self.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0)
        
        //取值可以省略size，赋值不能
        self.bounds.size.width = UIScreen.main.bounds.width
        
        
    }
}
